using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace hao_Common.Dapper.Query
{
    public interface IQueryBuilder<T>
    {
        // 参数管理
        Dictionary<string, object> Param { get; }
        
        // 基础查询条件
        IQueryBuilder<T> Where(Expression<Func<T, bool>> exp);
        IQueryBuilder<T> OrWhere(Expression<Func<T, bool>> exp);
        
        // 排序
        IQueryBuilder<T> OrderBy<TResult>(Expression<Func<T, TResult>> exp);
        IQueryBuilder<T> OrderByDescending<TResult>(Expression<Func<T, TResult>> exp);
        
        // 分组
        IQueryBuilder<T> GroupBy<TResult>(Expression<Func<T, TResult>> exp);
        
        // 选择
        IQueryBuilder<T> Select<TResult>(Expression<Func<T, TResult>> exp);
        IQueryBuilder<T> SelectCount();
        
        // 限制
        IQueryBuilder<T> Limit(int count);
        IQueryBuilder<T> Skip(int count);
        
        // 更新
        IQueryBuilder<T> Update<TResult>(Expression<Func<T, TResult>> newExp);
        
        // 生成SQL
        string GetQuery();
        string GetCountQuery();
    }
}